import Reqwest from '../../utils/Reqwest';
import {AreaTreeBean} from './AreaTreeBean';
import {base, assign, redirect}  from '../base/Base';
import {ResponseDto} from '../base/BaseDTO'
declare let GLOBAL:any;

export class AreaTreeController{
    path = `${GLOBAL.baseApiUrl}/area/api`;

    loadTree(params?:{
        version?:string
    },options={}):Promise<any>{
        return new Reqwest(assign({
            url: `${this.path}/allAreas.jhtml`,
            method: 'get',
            type: 'json',
            data:params || '',
            contentType: 'application/json; charset=UTF-8',
            headers: {
                'X-CSRF-TOKEN': base._csrf
            }
        },options)).catch(redirect);
    }
}